{% extends "layout.html" %}

{% block content %}
    {% for flashMessage in message %}
        <p class="bg-danger" style="padding: 15px;">{{ flashMessage }}</p>
    {% endfor %}
    <div class="wrap">
        <h1 class="wp-heading-inline">书籍</h1>

        <a href="admin.php?page=maosea0125_book&action=edit" class="page-title-action">新建书籍</a>
        <hr class="wp-header-end">
        
        <br />
        <table class="table table-striped table-bordered table-hover">
            <thead>
                <tr>
                    <th width="5%">ID</th>
                    <th width="20%">ISBN</th>
                    <th width="*">书籍名称</th>
                    <th width="5%"></th>
                </tr>
            </thead>
            <tbody>
                {% if pagination.getNbResults() == 0 %}
                    <tr><td style="text-align:center;" colspan='6'>暂时没有数据</td></tr>
                {% else %}
                    {% for item in pagination %}
                        <tr data-id="{{ item.Id }}">
                            <td>{{ item.id }}</td>
                            <td>{{ item.isbn }}</td>
                            <td>{{ item.name }}</td>
                            <td>
                                <a title="编辑" href="admin.php?page=maosea0125_book&action=edit&id={{item.id}}" role="button"><i class="glyphicon glyphicon-pencil"></i></a>
                                <a title="删除" href="admin.php?page=maosea0125_book&action=delete&id={{item.id}}" role="button"><i class="glyphicon glyphicon-remove"></i></a>
                            </td>
                        </tr>
                    {% endfor %}
                {% endif %}
            </tbody>
        </table>
        {% if pagination.haveToPaginate() %}
            <ul class="pagination">
                {% if pagination.getPage() != pagination.getPreviousPage() %}
                    <li><a href="admin.php?page=maosea0125_book&pager={{ pagination.getPreviousPage() }}">上一页</a></li>
                {% endif %}
                {% if pagination.getPage() != pagination.getNextPage() %}
                    <li><a href="admin.php?page=maosea0125_book&pager={{ pagination.getNextPage() }}">下一页</a></li>
                {% endif %}
            </ul>
        {% endif %}
    </div>
{% endblock %}